﻿using Core.Domain.Entities;
using Finbuckle.MultiTenant;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace Infrastructure.Persistence.Configurations;

public class RoleConfiguration : IEntityTypeConfiguration<Role>
{
    public void Configure(EntityTypeBuilder<Role> builder)
    {
        builder
            .ToTable("Roles", "identity")
            .IsMultiTenant();

        // 1. 主键
        builder.HasKey(u => u.Id);

        builder.Property(u => u.Code).HasMaxLength(100).IsRequired(false);
        builder.Property(u => u.Name).HasMaxLength(100).IsRequired(false);
    }
}
